//
//  ViewController.m
//  Book
//
//  Created by blue on 15-12-4.
//  Copyright (c) 2015年 zx. All rights reserved.
//

#import "ViewController.h"
#import "BookViewController.h"
@interface ViewController ()

{
    NSMutableArray * bookname;
    
}
@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.title = @"小说列表";
	bookname = @[
             @"红楼梦",
             @"西游记",
             @"水浒传"
             ].mutableCopy;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return bookname.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString * reuse = @"bookname";
    
    UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:reuse];
    if (!cell) {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuse];
    }
    cell.textLabel.text = bookname[indexPath.row];
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    BookViewController * con = [[BookViewController alloc]initWithStyle:UITableViewStyleGrouped];
    
    [self.navigationController pushViewController:con animated:YES];
    
   
}
- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
    
}

@end
